package Question3_2;

import java.util.Stack;

@SuppressWarnings("serial")
public class StackWithMin2 extends Stack<NodeWithNode>{
	
	public StackWithMin2(){
		
	}
	
	public void push(int data){
		int min = Math.min(min(), data);
		super.push(new NodeWithNode(data,min));
	}
	
	public int min(){
		if(isEmpty()){
			return Integer.MAX_VALUE;
		}else{
			return peek().min;
		}
	}
}
